// pages/movDetail/movDetail.js
const {movie} = require("../../models/movie")
const {transformStar} = require("../../utils/index")
Page({
  data: {
    reault:""
  },
  onLoad: function (options) {
    var {title,keyword} = options
    wx.setNavigationBarTitle({
      title
    });
    movie(keyword).then(res=>{
      res.data.result.forEach(item=>{
        if(item.title.length>6){
          item.title = item.title.slice(0,6)+'...'
        }
        item.star = transformStar(item.rating)
      })
      this.setData({
        result:res.data.result
      })
    })
  }
})